﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;

namespace WindowsFormsApp3
{
    /// <summary>
    /// 心类
    /// </summary>
    class Heart
    {
        //定义心的下落速度
        private const int SpeedY = 8;
        private const int SpeedX = 10;

        public Rectangle Rectangle { get; set; }

        public Heart (Rectangle rectangle)
        {
            Rectangle = rectangle;

        }
        //绘制心
        public void Drawheart(Graphics g)
        {           
                g.DrawImage(Properties.Resources.Heart, Rectangle);
        }

        public void Drawsnow(Graphics g)
        {
            g.DrawImage(Properties.Resources.Snow, Rectangle);
        }

        //定义心的下落函数
        public void HeartMove()
        {
            this.Rectangle = new Rectangle(this.Rectangle.X-SpeedX , this.Rectangle.Y+SpeedY, Rectangle.Width, Rectangle.Height);
           
        }
        //处理鸟与心的碰撞
        public bool HeartTouch(Rectangle rectangle)
        {
            if (rectangle.IntersectsWith(Rectangle) )
            {

                return true;
            }
            else
            {
                return false;
            }
        }

    }
}
